package phoenix.web.test_suites.clickandflirt.critical;

import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import phoenix.core.base.TestSuiteBase;
import phoenix.core.data_models.TestUserDataModel;
import phoenix.core.data_models.UserProfileDataModel.AboutMe;
import phoenix.core.data_models.UserProfileDataModel.LookingFor;
import phoenix.core.data_models.UserProfileDataModel.PaymentDetails;
import phoenix.web.test_objects.ActivityTests;
import phoenix.web.test_objects.BackendTests;
import phoenix.web.test_objects.FunnelTests;
import phoenix.web.test_objects.LoginTests;
import phoenix.web.test_objects.MyAccountTests;
import phoenix.web.test_objects.MyProfileTests;
import phoenix.web.test_objects.PaymentTests;
import phoenix.web.test_objects.RegistrationTests;
import phoenix.web.test_objects.UserPageTests;

/**
 * Test suite - Critical tests
 */
public class CriticalTS extends TestSuiteBase
{
	// Tests
	private final RegistrationTests registrationTests = new RegistrationTests(phoenix);
	private final BackendTests backendTests = new BackendTests(phoenix);
	private final LoginTests loginTests = new LoginTests(phoenix);
	private final FunnelTests funnelTests = new FunnelTests(phoenix);
	private final PaymentTests paymentTests = new PaymentTests(phoenix);
	private final UserPageTests userPageTests = new UserPageTests(phoenix);
	private final MyAccountTests myAccountTests = new MyAccountTests(phoenix);
	private final MyProfileTests myProfileTests = new MyProfileTests(phoenix);
	private final ActivityTests activityTests = new ActivityTests(phoenix);

	@DataProvider
	public Object[][] registrationDataMale()
	{
		return registrationTests.dataProviders.registrationDataMale();
	}

	@DataProvider
	public Object[][] registrationDataFemale()
	{
		return registrationTests.dataProviders.registrationDataFemale();
	}

	@DataProvider
	public Object[][] funnelData()
	{
		return funnelTests.dataProviders.funnelData();
	}

	@DataProvider
	public Object[][] loginData()
	{
		return loginTests.dataProviders.loginData();
	}

	@DataProvider
	public Object[][] paymentData()
	{
		return paymentTests.dataProviders.paymentData();
	}

	@DataProvider
	public Object[][] userPageDataMale()
	{
		return userPageTests.dataProviders.interactionDataMale();
	}

	@DataProvider
	public Object[][] userPageDataFemale()
	{
		return userPageTests.dataProviders.interactionDataFemale();
	}

	@DataProvider
	public Object[][] myAccountData()
	{
		return myAccountTests.dataProviders.myAccountData();
	}

	@DataProvider
	public Object[][] myProfileData()
	{
		return myProfileTests.dataProviders.myProfileData();
	}

	@DataProvider
	public Object[][] activityData()
	{
		return activityTests.dataProviders.recepientData();
	}

	@DataProvider
	public Object[][] userWithPhotoData()
	{
		return userPageTests.dataProviders.userWithPhotoData();
	}

	@DataProvider
	public Object[][] counterBrowseData()
	{
		return activityTests.dataProviders.recepientDataCountersBrowse();
	}

	@DataProvider
	public Object[][] counterWinkData()
	{
		return activityTests.dataProviders.recepientDataCountersWink();
	}

	@DataProvider
	public Object[][] counterMessageData()
	{
		return activityTests.dataProviders.recepientDataCountersMessage();
	}

	@DataProvider
	public Object[][] notificationBrowseData()
	{
		return activityTests.dataProviders.notificationBrowseData();
	}

	@DataProvider
	public Object[][] notificationWinkData()
	{
		return activityTests.dataProviders.notificationWinkData();
	}

	@DataProvider
	public Object[][] notificationMessageData()
	{
		return activityTests.dataProviders.notificationMessageData();
	}

	@DataProvider
	public Object[][] userDataPhoto()
	{
		return userPageTests.dataProviders.userWithPhotoData();
	}

	@Test(dataProvider = "registrationDataMale", groups = { "registration" }, priority = 1, enabled = true)
	public void registrationMaleTest(String p_userGender, String p_userEmail, String p_userPassword, String p_userBirthDay, String p_userBirthMonth,
		String p_userBirthYear)
	{
		registrationTests.registrationTest(p_userGender, p_userEmail, p_userPassword, p_userBirthDay, p_userBirthMonth, p_userBirthYear);
	}

	@Test(dependsOnMethods = { "registrationMaleTest" }, groups = { "registration" }, priority = 2, enabled = true)
	public void getUserDataTest()
	{
		backendTests.getUserDataTest(testUser().getEmail());
	}

	@Test(dependsOnMethods = { "getUserDataTest" }, dataProvider = "loginData", groups = { "login" }, priority = 3, enabled = true)
	public void loginUnConfirmedMaleTest(String p_userLogin, String p_userPassword)
	{
		loginTests.loginUnConfirmedTest(p_userLogin, p_userPassword);
	}

	@Test(dependsOnMethods = { "getUserDataTest" }, groups = { "registration" }, priority = 4, enabled = true)
	public void confirmationMaleTest()
	{
		funnelTests.confirmationTest();
	}

	@Test(dependsOnGroups = { "registration" }, dataProvider = "funnelData", groups = { "funnel" }, priority = 5, enabled = true)
	public void funnelMaleTest(String p_screenName, LookingFor p_lookingForParams, AboutMe p_aboutMeParams)
	{
		funnelTests.funnelTest(p_screenName, p_lookingForParams, p_aboutMeParams);
	}

	@Test(dependsOnGroups = { "registration" }, groups = { "funnel" }, priority = 6, enabled = true)
	public void photoUploadMotivationMaleTest()
	{
		funnelTests.photoUploadMotivationTest();
	}

	@Test(dependsOnGroups = { "registration" }, dataProvider = "loginData", groups = { "login" }, priority = 7, enabled = true)
	public void loginConfirmedMaleTest(String p_userLogin, String p_userPassword)
	{
		loginTests.loginConfirmedTest(p_userLogin, p_userPassword);
	}

	@Test(dependsOnMethods = "confirmationMaleTest", dataProvider = "counterBrowseData", groups = { "activity" }, priority = 9, enabled = true)
	public void counterBrowseIncrementTest(TestUserDataModel p_recepientBrowse)
	{
		activityTests.counterBrowseIncrementTest(p_recepientBrowse);
	}

	@Test(dependsOnMethods = "counterBrowseIncrementTest", dataProvider = "counterBrowseData", groups = { "activity" }, priority = 10, enabled = true)
	public void counterBrowseDecrementTest(TestUserDataModel p_recepientBrowse)
	{
		activityTests.counterBrowseDecrementTest(p_recepientBrowse);
	}

	@Test(dependsOnMethods = "confirmationMaleTest", dataProvider = "counterWinkData", groups = { "activity" }, priority = 10, enabled = true)
	public void counterWinkIncrementTest(TestUserDataModel p_recepientWink)
	{
		activityTests.counterWinkIncrementTest(p_recepientWink);
	}

	@Test(dependsOnMethods = "counterWinkIncrementTest", dataProvider = "counterWinkData", groups = { "activity" }, priority = 11, enabled = true)
	public void counterWinkDecrementTest(TestUserDataModel p_recepientWink)
	{
		activityTests.counterWinkDecrementTest(p_recepientWink);
	}

	@Test(dependsOnMethods = "confirmationMaleTest", dataProvider = "counterMessageData", groups = { "activity" }, priority = 12, enabled = true)
	public void counterMessageIncrementTest(TestUserDataModel p_recepientMessage)
	{
		activityTests.counterMessageIncrementTest(p_recepientMessage);
	}

	@Test(dependsOnMethods = "counterMessageIncrementTest", dataProvider = "counterMessageData", groups = { "activity" }, priority = 13, enabled = true)
	public void counterMessageDecrementTest(TestUserDataModel p_recepientMessage)
	{
		activityTests.counterMessageDecrementTest(p_recepientMessage);
	}

	@Test(dependsOnMethods = { "confirmationMaleTest" }, dataProvider = "notificationBrowseData", groups = { "activity" }, priority = 14, enabled = true)
	public void notificationBrowseTest(TestUserDataModel p_user)
	{
		activityTests.notificationBrowseTest(p_user);
	}

	@Test(dependsOnMethods = { "confirmationMaleTest" }, dataProvider = "notificationMessageData", groups = { "activity" }, priority = 15, enabled = true)
	public void notificationMessageTest(TestUserDataModel p_user)
	{
		activityTests.notificationMessageTest(p_user);
	}

	@Test(dependsOnMethods = { "confirmationMaleTest" }, dataProvider = "notificationWinkData", groups = { "activity" }, priority = 16, enabled = true)
	public void notificationWinkTest(TestUserDataModel p_user)
	{
		activityTests.notificationWinkTest(p_user);
	}

	@Test(dependsOnMethods = { "confirmationMaleTest" }, dataProvider = "userPageDataMale", groups = { "interaction" }, priority = 17, enabled = true)
	public void interactionsTest(TestUserDataModel p_userSender, TestUserDataModel p_userRecipient)
	{
		userPageTests.interactionsTest(p_userSender, p_userRecipient);
	}

	@Test(dependsOnMethods = { "confirmationMaleTest" }, dataProvider = "activityData", groups = { "activity" }, priority = 18, enabled = true)
	public void activityWinkTest(TestUserDataModel p_recepient)
	{
		activityTests.activityWinkedTest(p_recepient);
	}

	@Test(dependsOnMethods = { "confirmationMaleTest" }, dataProvider = "activityData", groups = { "activity" }, priority = 19, enabled = true)
	public void activityBrowseTest(TestUserDataModel p_recepient)
	{
		activityTests.activityBrowsedTest(p_recepient);
	}

	@Test(dependsOnMethods = { "confirmationMaleTest" }, dataProvider = "activityData", groups = { "activity" }, priority = 20, enabled = true)
	public void activityFavoritsTest(TestUserDataModel p_recepient)
	{
		activityTests.activityFavoritsTest(p_recepient);
	}

	@Test(dependsOnMethods = { "confirmationMaleTest" }, dataProvider = "paymentData", groups = { "male" }, priority = 24, enabled = true)
	public void paymentPackageTest(PaymentDetails p_paymentDataParams, boolean p_expectedResult)
	{
		paymentTests.paymentPackageTest(p_paymentDataParams, p_expectedResult);
	}

	@Test(dependsOnMethods = { "paymentPackageTest" }, dataProvider = "paymentData", groups = { "male" }, priority = 25, enabled = true)
	public void paymentFeaturesTest(PaymentDetails p_paymentDataParams, boolean p_expectedResult)
	{
		paymentTests.paymentFeaturesTest(p_paymentDataParams, p_expectedResult);
	}

	@Test(dependsOnMethods = { "confirmationMaleTest" }, dataProvider = "myAccountData", groups = { "male" }, priority = 26, enabled = true)
	public void mySettingsTest(String p_newEmail)
	{
		myAccountTests.mySettingsTests(p_newEmail);
	}

	@Test(dependsOnGroups = { "male" }, dataProvider = "registrationDataFemale", groups = { "female" }, priority = 27, enabled = true, alwaysRun = true)
	public void registrationFemaleTest(String p_userGender, String p_userEmail, String p_userPassword, String p_userBirthDay, String p_userBirthMonth,
		String p_userBirthYear)
	{
		registrationTests.registrationTest(p_userGender, p_userEmail, p_userPassword, p_userBirthDay, p_userBirthMonth, p_userBirthYear);
	}

	@Test(dependsOnMethods = { "registrationFemaleTest" }, groups = { "female" }, priority = 28, enabled = true)
	public void getUserDataFemaleTest()
	{
		backendTests.getUserDataTest(testUser().getEmail());
	}

	@Test(dependsOnMethods = { "getUserDataFemaleTest" }, groups = { "female" }, priority = 29, enabled = true)
	public void confirmationFemaleTest()
	{
		funnelTests.confirmationTest();
	}

	@Test(dependsOnMethods = "confirmationFemaleTest", dataProvider = "funnelData", groups = { "female" }, priority = 30, enabled = true)
	public void funnelFemaleTest(String p_screenName, LookingFor p_lookingForParams, AboutMe p_aboutMeParams)
	{
		funnelTests.funnelTest(p_screenName, p_lookingForParams, p_aboutMeParams);
	}

	@Test(dependsOnMethods = { "confirmationFemaleTest" }, groups = { "female" }, priority = 31, enabled = true)
	public void photoUploadMotivationFemaleTest()
	{
		funnelTests.photoUploadMotivationTest();
	}

	@Test(dependsOnMethods = "confirmationFemaleTest", dataProvider = "userPageDataFemale", groups = { "female" }, priority = 32, enabled = true)
	public void interactionsFemaleTest(TestUserDataModel p_userSender, TestUserDataModel p_userRecipient)
	{
		userPageTests.interactionsTest(p_userSender, p_userRecipient);
	}
}